home *** CD-ROM | disk | FTP | other *** search
- Path: news.delphi.com!usenet
- From: Derek Harmon <stonelight@delphi.com>
- Newsgroups: comp.lang.c
- Subject: Re: What's wrong here?
- Date: Thu, 1 Feb 96 00:38:59 -0500
- Organization: Delphi (info@delphi.com email, 800-695-4005 voice)
- Message-ID: <BDNphyL.stonelight@delphi.com>
- References: <4eml5o$o6h@airdmhor.gen.nz>
- NNTP-Posting-Host: bos1f.delphi.com
- X-To: Simon Hosie <gumboot@airdmhor.gen.nz>
-
- Simon Hosie <gumboot@airdmhor.gen.nz> writes:
-
- > 12: d = a | b | c;
- > 13:
- > 14: d |= a;
- > 15:
- > 16: d |= a | b;
- > 17: d = d | a | b;
-
- Ah, the problem for the warnings (integer may be truncated) is probably
- that Watcom is generating intermediate code which (in the case of line 12)
- first does a bitwise-OR b, and stores it in an int (not a SHORT int), and then
- does the other bitwise-OR. In fitting that back into d, there would be
- truncation (although it is not relevant in this example) when squeezing the
- int into a short int again. The lines which did not produce warnings in-
- volved |= which dumps the result into d.
-
- This is just conjecture, but perhaps the definition for the |-operator
- on short ints (and int-promotion) and the |=-assignment operator are handled
- differently in C++ (as in that language | can have meaning for spoons and
- forks, if defined so.. :) ).
-
- -- Stone
- --
- ... Old programmers never die, they just get lost in the loop.
-